#include "threadclass.h"
#include <QTimer>
#include <QDebug>

ThreadClass::ThreadClass(QObject *parent) : QObject{parent} {
    connect(this, &ThreadClass::start, this, &ThreadClass::onStart);
    connect(this, &ThreadClass::stop, &loop, &QEventLoop::quit);
}

void ThreadClass::onStart() {
    QTimer timer;
    timer.callOnTimeout([&]() {
        static qintptr count = 0;
        qDebug() << "ThreadClass::onStart():" << count++;
    });
    connect(this, &ThreadClass::stop, &timer, &QTimer::stop);
    timer.start(100);

    loop.exec();
}
